home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / program / amcfp140.lha / AMCAF_Examples / GamePorts.AMOS / GamePorts.amosSourceCode < prev    next >
AMOS Source Code  |  1996-01-19  |  4KB  |  101 lines

  1. ' ************************************* Commands used: 
  2. ' *                                   * Limit Smouse       =Pjoy 
  3. ' *           Amcaf Examples          * =X Smouse          Smouse X
  4. ' *           GamePorts V1.3          * =Y Smouse          Smouse Y
  5. ' *      Written by Chris Hodges      * =Smouse Key
  6. ' *                                   * =Xfire 
  7. ' ************************************* Smouse Speed 
  8. '
  9. ' NOTE: Requires lowlevel.library for all functions! 
  10. '       If two joysticks are 'yellow', a printer is connected instead
  11. '       of a four player adapter.
  12. '
  13. ' Check for lowlevel.library:
  14. Trap DUMMY= Extension_8_15BE(0,2)
  15. If Errtrap Then LOWLEVEL=0 Else LOWLEVEL=1
  16. ' First open a screen for the graphics.
  17. Screen Open 0,320,200,32,0
  18. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  19. Wait Vbl 
  20. ' Now create the icon mask and load the correct palette
  21. Make Icon Mask 
  22. Get Icon Palette 
  23. ' Limit the two mice to the screen 
  24. Limit Mouse 
  25.  Extension_8_159C 
  26. ' Center the second mouse to the middle of the screen
  27.  Extension_8_1558 X Hard(160) : Extension_8_1568 Y Hard(100)
  28. ' Set the second mouse to the same speed it's in AMOS. 
  29.  Extension_8_1578 1
  30. ' Draw the four controllers
  31. X=64 : Y=16 : Paste Icon X,Y,1
  32. X=24 : Y=84 : Paste Icon X,Y,2
  33. X=216 : Y=16 : Paste Icon X,Y,1
  34. X=176 : Y=84 : Paste Icon X,Y,2
  35. Pen 31 : Paper 0 : Print "       Port 0             Port 1"
  36. ' Turn on double buffering for a flicker free display
  37. Double Buffer : Autoback 0
  38. ' Main loop
  39. Repeat 
  40.   ' Be system conform. No need to waste processor time.    
  41.   Screen Swap : Multi Wait 
  42.   ' Draw the second mouse sprite.
  43.   Sprite 1, Extension_8_153C , Extension_8_154A ,1
  44.   ' Check mouse ones buttons first.  
  45.   MK=Mouse Key : X=64 : Y=16 : Gosub DRAMOUSEBUTS
  46.   ' Draw port zeros joypads buttons    
  47.   P=0 : X=24 : Y=84 : Gosub DRAPADBUTS
  48.   ' Now check mouse two
  49.   MK= Extension_8_158C : X=216 : Y=16 : Gosub DRAMOUSEBUTS
  50.   ' And port ones buttons on the joypad
  51.   P=1 : X=176 : Y=84 : Gosub DRAPADBUTS
  52.   ' At last, all four joysticks
  53.   P=Joy(0) : X=16 : Y=132 : Gosub DRAJOYSTICK
  54.   P= Extension_8_08E0(0) : X=96 : Y=132 : Gosub DRAJOYSTICK
  55.   P=Joy(1) : X=176 : Y=132 : Gosub DRAJOYSTICK
  56.   P= Extension_8_08E0(1) : X=256 : Y=132 : Gosub DRAJOYSTICK
  57. Until Inkey$=Chr$(27)
  58. Sprite Off 
  59. Screen Close 0
  60. End 
  61. DRAMOUSEBUTS:
  62.   ' Left Button
  63.   Paste Icon X+4,Y+16,3+(MK and 1)
  64.   ' Right Button 
  65.   Paste Icon X+13,Y+16,3+(MK and 4)/4
  66.   ' Middle Button
  67.   Paste Icon X+22,Y+16,3+(MK and 2)/2
  68. Return 
  69. DRAPADBUTS:
  70.   ' Red fire button (normal fire button) 
  71.   Paste Icon X+92,Y+24,5- Extension_8_15BE(P,0)
  72.   ' Blue (second) fire button
  73.   Paste Icon X+103,Y+22,7- Extension_8_15BE(P,1)
  74.   ' The other buttons require the lowlevel.library 
  75.   If LOWLEVEL=0 Then Return 
  76.   ' Green fire button. Joypad only.    
  77.   Paste Icon X+101,Y+12,9- Extension_8_15BE(P,2)
  78.   ' Yellow fire button. Joypad only. 
  79.   Paste Icon X+90,Y+14,11- Extension_8_15BE(P,3)
  80.   ' Rewind button. Joypad only.  
  81.   Ink 0 : Bar X+9,Y To X+20,Y+3
  82.   Paste Icon X+6,Y-1,15- Extension_8_15BE(P,4)
  83.   ' Forward button. Joypad only
  84.   Ink 0 : Bar X+94,Y To X+106,Y+3
  85.   Paste Icon X+83,Y-1,17- Extension_8_15BE(P,5)
  86.   ' Pause button. Joypad only. 
  87.   Paste Icon X+57,Y+32,13- Extension_8_15BE(P,6)
  88. Return 
  89. DRAJOYSTICK:
  90.   ' Clear the old region 
  91.   Ink 0 : Bar X-16,Y To X+63,Y+67
  92.   ' Icon for no movement 
  93.   I=19
  94.   ' Check four directions
  95.   If P and 1 Then I=20
  96.   If P and 2 Then I=21
  97.   If P and 4 Then I=23 : Add X,-16
  98.   If P and 8 Then I=22
  99.   ' Paste the icon and check for fire button 
  100.   Paste Icon X,Y,I-((P and 16)<>0)*5
  101. Return